//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#include <crwlock.h>
#include <aura.h>

CReaderWriterLock::CReaderWriterLock()
{
}

CReaderWriterLock::~CReaderWriterLock()
{
}

ECode CReaderWriterLock::Initialize()
{
    return E_NOT_IMPLEMENTED;
}

PInterface CReaderWriterLock::Probe(
    /* [in]  */ REIID riid)
{
    return NULL;
}

UInt32 CReaderWriterLock::AddRef()
{
    return 0;
}

UInt32 CReaderWriterLock::Release()
{
    return 0;
}

ECode CReaderWriterLock::Aggregate(
    /* [in]  */ AggregateType type,
    /* [in]  */ PInterface pObject)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::GetDomain(
    /* [out] */ PInterface * ppObject)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::ReaderLock(
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::ReaderTryLock(
    /* [in] */ Millisecond32 msTimeout,
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::ReaderUnlock()
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::UpgradeToWriter(
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::TryUpgradeToWriter(
    /* [in] */ Millisecond32 msTimeout,
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::WriterLock(
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::WriterTryLock(
    /* [in] */ Millisecond32 msTimeout,
    /* [out] */ WaitResult *pResult)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::WriterUnlock()
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::DowngradeFromWriter()
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::IsReaderLockHeld(
    /* [out] */ Boolean *pIsHeld)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::IsWriterLockHeld(
    /* [out] */ Boolean *pIsHeld)
{
    return E_NOT_IMPLEMENTED;
}

ECode CReaderWriterLock::S_Create(
    /* [out] */ IReaderWriterLock ** ppRwlock)
{
    CReaderWriterLock * pRwlock = NULL;
    ECode ec = NOERROR;

    assert(NULL != ppRwlock);
    pRwlock = new CReaderWriterLock();
    if (NULL == pRwlock) {
        ec = E_OUT_OF_MEMORY;
        goto ErrorExit;
    }

    ec = pRwlock->Initialize();
    if (FAILED(ec)) {
        goto ErrorExit;
    }

    *ppRwlock = (IReaderWriterLock *)pRwlock;
    (*ppRwlock)->AddRef();

    return NOERROR;

ErrorExit:
    if (NULL != pRwlock) {
        delete pRwlock;
        pRwlock = NULL;
    }
    return ec;
}

